<template>
    <tbody>
        <tr v-for="(item, index) in records" :key="index">
            <td>{{ item.date }} </td>
            <td>{{ item.doctor }}</td>
            <td>{{ item.diagnosis }}</td>
            <td>{{ item.prescription }}</td>
            <td @click="() => show(item)">详情</td>
        </tr>
    </tbody>
</template>

<script>
import Bus from '@/utils/EventBus';

export default {
    props: {
        records: {
            type: Array,
            required: true
        },
        isShow: {
            type: Boolean,
            required: true
        }
    },

    data() {
        return {
            isShown: this.isShow,
            record: this.records[0],
        }
    },

    methods: {
        show(item) {
            Bus.$emit('show', this.isShown)
            Bus.$emit('detail', item)
        },
    },
}
</script>

<style></style>